package reflect;

import reflect.annotations.AutoRunMethod;

import java.lang.reflect.Method;

/**
 * 在反射机制中获取注解的参数
 */
public class ReflectDemo10 {
    public static void main(String[] args) throws Exception{
        Class cls =Class.forName("reflect.Person");
        Method[] methods=cls.getDeclaredMethods();
        for (Method method:methods){
            if (method.isAnnotationPresent(AutoRunMethod.class));
            AutoRunMethod arm = method.getAnnotation(AutoRunMethod.class);
            int value=arm.value();
            System.out.println("方法"+method.getName()+"参数值:"+value);
        }
    }
}
